import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
const router = new VueRouter({
  routes: [
    { path: "/", redirect: "/home" },
    {
      path: "/home",
      component: () => import("@/Home.vue"),
      children: [
        {
          path: "/",
          redirect: "/discover",
        },
        {
          path: "/discover",
          component: () => import("@/view/discover/Discover.vue"),
          children: [
            {
              path: "/",
              redirect: "/discover/recommend",
            },
            {
              path: "recommend",
              component: () =>
                import("@/view/discover/discoverDtail/Recommend.vue"),
            },
            {
              path: "ranking",
              component: () =>
                import("@/view/discover/discoverDtail/Ranking.vue"),
            },
            {
              path: "singer",
              component: () =>
                import("@/view/discover/discoverDtail/Singer.vue"),
            },
            {
              path: "musiclist",
              component: () =>
                import("@/view/discover/discoverDtail/Musiclist.vue"),
            },
          ],
        },
        {
          path: "/musiclistdetail/:id",
          name: "musiclistdetail",
          component: () => import("@/view/musicListDetail/MusicListDetail.vue"),
        },
        {
          path: "/singerdetail/:id",
          name: "singerdetail",
          component: () => import("@/view/singer/SingerDetail.vue"),
        },
        {
          path: "/personal",
          component: () => import("@/view/personal/Personal.vue"),

          children: [
            { path: "/", redirect: "/index" },
            {
              path: "/pindex",
              name: "personalIndex",
              component: () =>
                import("@/view/personal/personChildren/Index.vue"),
            },
            {
              path: "/mylove",
              component: () =>
                import("@/view/personal/personChildren/MyLove.vue"),
            },
            {
              path: "/myfans",
              component: () =>
                import("@/view/personal/personChildren/MyFans.vue"),
            },
          ],
        },
        {
          path: "/search",
          component: () => import("@/view/search/Search.vue"),
          name: "search",
          redirect: "/search/searchSong/:id ",
          children: [
            {
              path: "searchSong/:id",
              component: () =>
                import("@/view/search/searchChildren/searchSong.vue"),
            },
            {
              path: "searchSinger/:id",
              component: () =>
                import("@/view/search/searchChildren/searchSinger.vue"),
            },
            {
              path: "searchAlbum/:id",
              component: () =>
                import("@/view/search/searchChildren/searchAlbum.vue"),
            },
            {
              path: "searchVideo/:id",
              component: () =>
                import("@/view/search/searchChildren/searchVideo.vue"),
            },
            {
              path: "searchDetail/:id",
              component: () =>
                import("@/view/search/searchChildren/searchDetail.vue"),
            },
          ],
        },
        {
          path: "/video",
          component: () => import("@/view/video/video.vue"),
          children: [
            { path: "/", redirect: "/video/videolist" },
            {
              path: "videolist",
              component: () =>
                import("@/view/video/videoChildren/VideoList.vue"),
            },
            {
              path: "mvlist",
              component: () => import("@/view/video/videoChildren/MvList.vue"),
            },
          ],
        },
        {
          path: "/videodetail/:id",
          component: () => import("@/view/viedoDetail/videoDetail.vue"),
          name: "videodetail",
        },
        {
          path: "/favorites",
          component: () => import("@/view/favorites/Favorites.vue"),
        },
        {
          path: "/recommendmusic",
          component: () => import("@/view/recommendmusic/RecommendMusic.vue"),
        },
      ],
    },
  ],
});
const originalPush = VueRouter.prototype.push;

// VueRouter.prototype.push = function push(location) {
//   return originalPush.call(this, location).catch((err) => err);
// };
export default router;
